!pip install seaborn
WARNING: You are using pip version 21.0.1; however, version 21.3.1 is available. You should consider upgrading via the 'c:\users\2104944461\anaconda3\python.exe -m pip install --upgrade pip' command.
Looking in indexes: https://pypi.org/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/pypi Requirement already satisfied: seaborn in c:\users\2104944461\anaconda3\lib\site-packages (0.11.0) Requirement already satisfied: scipy>=1.0 in c:\users\2104944461\anaconda3\lib\site-packages (from seaborn) (1.6.1) Requirement already satisfied: numpy>=1.15 in c:\users\2104944461\anaconda3\lib\site-packages (from seaborn) (1.19.5) Requirement already satisfied: matplotlib>=2.2 in c:\users\2104944461\anaconda3\lib\site-packages (from seaborn) (3.3.2) Requirement already satisfied: pandas>=0.23 in c:\users\2104944461\anaconda3\lib\site-packages (from seaborn) (1.1.3) Requirement already satisfied: python-dateutil>=2.1 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (2.8.1) Requirement already satisfied: cycler>=0.10 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (0.10.0) Requirement already satisfied: certifi>=2020.06.20 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (2020.12.5) Requirement already satisfied: pillow>=6.2.0 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (8.0.1) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (1.3.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=2.2->seaborn) (2.4.7) Requirement already satisfied: six in c:\users\2104944461\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib>=2.2->seaborn) (1.15.0) Requirement already satisfied: pytz>=2017.2 in c:\users\2104944461\anaconda3\lib\site-packages (from pandas>=0.23->seaborn) (2020.1)

o Contexto: este dataset contém o resultado de 122 mil momentos que aconteceram durante mais de 700 partidas de campeonatos de alto nível do jogo Counter-Strike: Global Offensive. Temos dados como, por exemplo, o arsenal de ambas as equipes (CT e T), o dinheiro disponível para as duas equipes, o mapa, entre outros. A ideia é prever o vencedor da partida (round_winner).
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
base = pd.read_csv("csgo_round_snapshots.csv")
import seaborn as sns
sns.set_theme(style="white")
sns.heatmap(base.isnull().T)
<AxesSubplot:>
base['round_winner'].count()
122410
base.groupby(['map']).count()
| time_left | ct_score | t_score | ct_health | t_health | ct_money | t_money | ct_helmets | t_helmets | ct_defuse_kits | ct_players_alive | t_players_alive | ct_weapon_ak47 | t_weapon_ak47 | ct_weapon_aug | t_weapon_aug | ct_weapon_awp | t_weapon_awp | ct_weapon_bizon | t_weapon_bizon | ct_weapon_cz75auto | t_weapon_cz75auto | ct_weapon_elite | t_weapon_elite | ct_weapon_famas | t_weapon_famas | ct_weapon_g3sg1 | t_weapon_g3sg1 | ct_weapon_galilar | t_weapon_galilar | ct_weapon_glock | t_weapon_glock | ct_weapon_m249 | t_weapon_m249 | ct_weapon_m4a1s | t_weapon_m4a1s | ct_weapon_m4a4 | t_weapon_m4a4 | ct_weapon_mac10 | t_weapon_mac10 | ct_weapon_mag7 | t_weapon_mag7 | ct_weapon_mp5sd | t_weapon_mp5sd | ct_weapon_mp7 | t_weapon_mp7 | ct_weapon_mp9 | t_weapon_mp9 | ct_weapon_negev | t_weapon_negev | ct_weapon_nova | t_weapon_nova | ct_weapon_p90 | t_weapon_p90 | ct_weapon_r8revolver | t_weapon_r8revolver | ct_weapon_sawedoff | t_weapon_sawedoff | ct_weapon_scar20 | t_weapon_scar20 | ct_weapon_sg553 | t_weapon_sg553 | ct_weapon_ssg08 | t_weapon_ssg08 | ct_weapon_ump45 | t_weapon_ump45 | ct_weapon_xm1014 | t_weapon_xm1014 | ct_weapon_deagle | t_weapon_deagle | ct_weapon_fiveseven | t_weapon_fiveseven | ct_weapon_usps | t_weapon_usps | ct_weapon_p250 | t_weapon_p250 | ct_weapon_p2000 | t_weapon_p2000 | ct_weapon_tec9 | t_weapon_tec9 | ct_grenade_hegrenade | t_grenade_hegrenade | ct_grenade_flashbang | t_grenade_flashbang | ct_grenade_smokegrenade | t_grenade_smokegrenade | ct_grenade_incendiarygrenade | t_grenade_incendiarygrenade | ct_grenade_molotovgrenade | t_grenade_molotovgrenade | ct_grenade_decoygrenade | t_grenade_decoygrenade | round_winner | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| map | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| de_cache | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 | 145 |
| de_dust2 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 | 22144 |
| de_inferno | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 | 23811 |
| de_mirage | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 | 18576 |
| de_nuke | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 | 19025 |
| de_overpass | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 | 14081 |
| de_train | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 | 13491 |
| de_vertigo | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 | 11137 |
base['round_winner'].value_counts()
T 62406 CT 60004 Name: round_winner, dtype: int64
base.describe().transpose()
| count | mean | std | min | 25% | 50% | 75% | max | |
|---|---|---|---|---|---|---|---|---|
| time_left | 122410.0 | 97.886922 | 54.465238 | 0.01 | 54.92 | 94.91 | 166.9175 | 175.0 |
| ct_score | 122410.0 | 6.709239 | 4.790362 | 0.00 | 3.00 | 6.00 | 10.0000 | 32.0 |
| t_score | 122410.0 | 6.780435 | 4.823543 | 0.00 | 3.00 | 6.00 | 10.0000 | 33.0 |
| ct_health | 122410.0 | 412.106568 | 132.293290 | 0.00 | 350.00 | 500.00 | 500.0000 | 500.0 |
| t_health | 122410.0 | 402.714500 | 139.919033 | 0.00 | 322.00 | 500.00 | 500.0000 | 600.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| t_grenade_incendiarygrenade | 122410.0 | 0.019819 | 0.143933 | 0.00 | 0.00 | 0.00 | 0.0000 | 3.0 |
| ct_grenade_molotovgrenade | 122410.0 | 0.048011 | 0.227669 | 0.00 | 0.00 | 0.00 | 0.0000 | 3.0 |
| t_grenade_molotovgrenade | 122410.0 | 1.352095 | 1.663246 | 0.00 | 0.00 | 1.00 | 2.0000 | 5.0 |
| ct_grenade_decoygrenade | 122410.0 | 0.027694 | 0.169531 | 0.00 | 0.00 | 0.00 | 0.0000 | 3.0 |
| t_grenade_decoygrenade | 122410.0 | 0.025750 | 0.164162 | 0.00 | 0.00 | 0.00 | 0.0000 | 2.0 |
92 rows × 8 columns
base.dtypes
time_left float64
ct_score int64
t_score int64
map object
ct_health int64
...
ct_grenade_molotovgrenade int64
t_grenade_molotovgrenade int64
ct_grenade_decoygrenade int64
t_grenade_decoygrenade int64
round_winner object
Length: 94, dtype: object
pd.set_option('display.max_columns', None)
base.head()
| time_left | ct_score | t_score | map | ct_health | t_health | ct_money | t_money | ct_helmets | t_helmets | ct_defuse_kits | ct_players_alive | t_players_alive | ct_weapon_ak47 | t_weapon_ak47 | ct_weapon_aug | t_weapon_aug | ct_weapon_awp | t_weapon_awp | ct_weapon_bizon | t_weapon_bizon | ct_weapon_cz75auto | t_weapon_cz75auto | ct_weapon_elite | t_weapon_elite | ct_weapon_famas | t_weapon_famas | ct_weapon_g3sg1 | t_weapon_g3sg1 | ct_weapon_galilar | t_weapon_galilar | ct_weapon_glock | t_weapon_glock | ct_weapon_m249 | t_weapon_m249 | ct_weapon_m4a1s | t_weapon_m4a1s | ct_weapon_m4a4 | t_weapon_m4a4 | ct_weapon_mac10 | t_weapon_mac10 | ct_weapon_mag7 | t_weapon_mag7 | ct_weapon_mp5sd | t_weapon_mp5sd | ct_weapon_mp7 | t_weapon_mp7 | ct_weapon_mp9 | t_weapon_mp9 | ct_weapon_negev | t_weapon_negev | ct_weapon_nova | t_weapon_nova | ct_weapon_p90 | t_weapon_p90 | ct_weapon_r8revolver | t_weapon_r8revolver | ct_weapon_sawedoff | t_weapon_sawedoff | ct_weapon_scar20 | t_weapon_scar20 | ct_weapon_sg553 | t_weapon_sg553 | ct_weapon_ssg08 | t_weapon_ssg08 | ct_weapon_ump45 | t_weapon_ump45 | ct_weapon_xm1014 | t_weapon_xm1014 | ct_weapon_deagle | t_weapon_deagle | ct_weapon_fiveseven | t_weapon_fiveseven | ct_weapon_usps | t_weapon_usps | ct_weapon_p250 | t_weapon_p250 | ct_weapon_p2000 | t_weapon_p2000 | ct_weapon_tec9 | t_weapon_tec9 | ct_grenade_hegrenade | t_grenade_hegrenade | ct_grenade_flashbang | t_grenade_flashbang | ct_grenade_smokegrenade | t_grenade_smokegrenade | ct_grenade_incendiarygrenade | t_grenade_incendiarygrenade | ct_grenade_molotovgrenade | t_grenade_molotovgrenade | ct_grenade_decoygrenade | t_grenade_decoygrenade | round_winner | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 175.00 | 0 | 0 | de_dust2 | 500 | 500 | 4000 | 4000 | 0 | 0 | 0 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | CT |
| 1 | 156.03 | 0 | 0 | de_dust2 | 500 | 500 | 600 | 650 | 0 | 0 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | CT |
| 2 | 96.03 | 0 | 0 | de_dust2 | 391 | 400 | 750 | 500 | 0 | 0 | 1 | 4 | 4 | 0 | 0 | 0 | 0 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0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | CT |
plt.figure(figsize=(20,5))
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
data=base,
x="ct_score", y="t_score", hue="round_winner",
height=5
)
# Use more informative axis labels than are provided by default
g.set_axis_labels("Score - Multiple linear regression ", "round_winner ")
<seaborn.axisgrid.FacetGrid at 0x28c6743dd30>
<Figure size 1440x360 with 0 Axes>
# Plot sepal width as a function of sepal_length across days
g = sns.lmplot(
data=base,
x="ct_health", y="t_health", hue="round_winner",
height=5
)
# Use more informative axis labels than are provided by default
g.set_axis_labels("Health - Multiple linear regression ", "round_winner ")
<seaborn.axisgrid.FacetGrid at 0x28c64469d60>
plt.figure(figsize=(20,5))
sns.histplot(base[base['t_health']<=0.2 * 1e8 ]['ct_health'])
<AxesSubplot:xlabel='ct_health', ylabel='Count'>
Resolvi que para andar com o processo de analise exploratoria, preciso formatar os dados de string para tipos inteiros,usei um metodo de aplicação de apply para remover tudo que for string ct para 0 e T para 1, quero ver como é o comportamento do processo de t_score tambem, como ele se comporta em relação ao quantidade total por partida
base['round_winner'] = base['round_winner'].apply(lambda var: 0 if var == 'CT' else 1)
plt.figure(figsize=(20,5))
sns.histplot(base[base['t_score']<=0.2 * 1e8 ]['t_score'])
<AxesSubplot:xlabel='t_score', ylabel='Count'>
!pip3 install sweetviz
!pip3 install ipywidgets
Looking in indexes: https://pypi.org/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/pypi
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4280>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/sweetviz/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D44F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/sweetviz/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4760>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/sweetviz/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D49A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/sweetviz/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4BE0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/sweetviz/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D48B0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/sweetviz/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4D90>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/sweetviz/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4970>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/sweetviz/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D44F0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/sweetviz/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C4D4370>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/sweetviz/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C53C490>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/importlib-resources/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C53C6A0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/importlib-resources/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C53C8E0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/importlib-resources/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C53CB20>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/importlib-resources/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C53CD60>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/simple/importlib-resources/
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C548310>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/importlib-resources/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C548520>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/importlib-resources/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C548790>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/importlib-resources/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C5489D0>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/importlib-resources/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.HTTPConnection object at 0x000002659C548C10>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed')': /repository/pypi-data-science/pypi/importlib-resources/
WARNING: You are using pip version 21.0.1; however, version 21.3.1 is available.
You should consider upgrading via the 'c:\users\2104944461\anaconda3\python.exe -m pip install --upgrade pip' command.
Collecting sweetviz Downloading sweetviz-2.1.3-py3-none-any.whl (15.1 MB) Requirement already satisfied: pandas!=1.0.0,!=1.0.1,!=1.0.2,>=0.25.3 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (1.1.3) Requirement already satisfied: jinja2>=2.11.1 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (2.11.2) Requirement already satisfied: tqdm>=4.43.0 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (4.50.2) Collecting importlib-resources>=1.2.0 Downloading importlib_resources-5.4.0-py3-none-any.whl (28 kB) Requirement already satisfied: scipy>=1.3.2 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (1.6.1) Requirement already satisfied: matplotlib>=3.1.3 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (3.3.2) Requirement already satisfied: numpy>=1.16.0 in c:\users\2104944461\anaconda3\lib\site-packages (from sweetviz) (1.19.5) Requirement already satisfied: zipp>=3.1.0 in c:\users\2104944461\anaconda3\lib\site-packages (from importlib-resources>=1.2.0->sweetviz) (3.4.0) Requirement already satisfied: MarkupSafe>=0.23 in c:\users\2104944461\anaconda3\lib\site-packages (from jinja2>=2.11.1->sweetviz) (1.1.1) Requirement already satisfied: pillow>=6.2.0 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (8.0.1) Requirement already satisfied: cycler>=0.10 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (0.10.0) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (1.3.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (2.4.7) Requirement already satisfied: python-dateutil>=2.1 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (2.8.1) Requirement already satisfied: certifi>=2020.06.20 in c:\users\2104944461\anaconda3\lib\site-packages (from matplotlib>=3.1.3->sweetviz) (2020.12.5) Requirement already satisfied: six in c:\users\2104944461\anaconda3\lib\site-packages (from cycler>=0.10->matplotlib>=3.1.3->sweetviz) (1.15.0) Requirement already satisfied: pytz>=2017.2 in c:\users\2104944461\anaconda3\lib\site-packages (from pandas!=1.0.0,!=1.0.1,!=1.0.2,>=0.25.3->sweetviz) (2020.1) Installing collected packages: importlib-resources, sweetviz Successfully installed importlib-resources-5.4.0 sweetviz-2.1.3
WARNING: You are using pip version 21.0.1; however, version 21.3.1 is available. You should consider upgrading via the 'c:\users\2104944461\anaconda3\python.exe -m pip install --upgrade pip' command.
Looking in indexes: https://pypi.org/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/simple, http://nexus.viavarejo.com.br/repository/pypi-data-science/pypi Requirement already satisfied: ipywidgets in c:\users\2104944461\anaconda3\lib\site-packages (7.5.1) Requirement already satisfied: nbformat>=4.2.0 in c:\users\2104944461\appdata\roaming\python\python38\site-packages (from ipywidgets) (5.1.3) Requirement already satisfied: traitlets>=4.3.1 in c:\users\2104944461\anaconda3\lib\site-packages (from ipywidgets) (5.0.5) Requirement already satisfied: ipykernel>=4.5.1 in c:\users\2104944461\anaconda3\lib\site-packages (from ipywidgets) (5.3.4) Requirement already satisfied: widgetsnbextension~=3.5.0 in c:\users\2104944461\anaconda3\lib\site-packages (from ipywidgets) (3.5.1) Requirement already satisfied: ipython>=4.0.0 in c:\users\2104944461\anaconda3\lib\site-packages (from ipywidgets) (7.19.0) Requirement already satisfied: tornado>=4.2 in c:\users\2104944461\anaconda3\lib\site-packages (from ipykernel>=4.5.1->ipywidgets) (6.0.4) Requirement already satisfied: jupyter-client in c:\users\2104944461\anaconda3\lib\site-packages (from ipykernel>=4.5.1->ipywidgets) (6.1.7) Requirement already satisfied: colorama in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (0.4.4) Requirement already satisfied: decorator in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (4.4.2) Requirement already satisfied: jedi>=0.10 in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (0.17.1) Requirement already satisfied: pygments in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (2.7.2) Requirement already satisfied: backcall in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (0.2.0) Requirement already satisfied: pickleshare in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (0.7.5) Requirement already satisfied: prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0 in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (3.0.8) Requirement already satisfied: setuptools>=18.5 in c:\users\2104944461\anaconda3\lib\site-packages (from ipython>=4.0.0->ipywidgets) (50.3.1.post20201107) Requirement already satisfied: parso<0.8.0,>=0.7.0 in c:\users\2104944461\anaconda3\lib\site-packages (from jedi>=0.10->ipython>=4.0.0->ipywidgets) (0.7.0) Requirement already satisfied: ipython-genutils in c:\users\2104944461\anaconda3\lib\site-packages (from nbformat>=4.2.0->ipywidgets) (0.2.0) Requirement already satisfied: jupyter-core in c:\users\2104944461\anaconda3\lib\site-packages (from nbformat>=4.2.0->ipywidgets) (4.6.3) Requirement already satisfied: jsonschema!=2.5.0,>=2.4 in c:\users\2104944461\anaconda3\lib\site-packages (from nbformat>=4.2.0->ipywidgets) (3.2.0) Requirement already satisfied: attrs>=17.4.0 in c:\users\2104944461\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (20.3.0) Requirement already satisfied: pyrsistent>=0.14.0 in c:\users\2104944461\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (0.17.3) Requirement already satisfied: six>=1.11.0 in c:\users\2104944461\anaconda3\lib\site-packages (from jsonschema!=2.5.0,>=2.4->nbformat>=4.2.0->ipywidgets) (1.15.0) Requirement already satisfied: wcwidth in c:\users\2104944461\anaconda3\lib\site-packages (from prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0->ipython>=4.0.0->ipywidgets) (0.2.5) Requirement already satisfied: notebook>=4.4.1 in c:\users\2104944461\anaconda3\lib\site-packages (from widgetsnbextension~=3.5.0->ipywidgets) (6.1.4) Requirement already satisfied: argon2-cffi in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (20.1.0) Requirement already satisfied: terminado>=0.8.3 in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.9.1) Requirement already satisfied: pyzmq>=17 in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (19.0.2) Requirement already satisfied: prometheus-client in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.8.0) Requirement already satisfied: Send2Trash in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.5.0) Requirement already satisfied: nbconvert in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (6.0.7) Requirement already satisfied: jinja2 in c:\users\2104944461\anaconda3\lib\site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.11.2) Requirement already satisfied: python-dateutil>=2.1 in c:\users\2104944461\anaconda3\lib\site-packages (from jupyter-client->ipykernel>=4.5.1->ipywidgets) (2.8.1) Requirement already satisfied: pywin32>=1.0 in c:\users\2104944461\anaconda3\lib\site-packages (from jupyter-core->nbformat>=4.2.0->ipywidgets) (227) Requirement already satisfied: pywinpty>=0.5 in c:\users\2104944461\anaconda3\lib\site-packages (from terminado>=0.8.3->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.5.7) Requirement already satisfied: cffi>=1.0.0 in c:\users\2104944461\anaconda3\lib\site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.14.3) Requirement already satisfied: pycparser in c:\users\2104944461\anaconda3\lib\site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.20) Requirement already satisfied: MarkupSafe>=0.23 in c:\users\2104944461\anaconda3\lib\site-packages (from jinja2->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.1.1) Requirement already satisfied: defusedxml in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.6.0) Requirement already satisfied: entrypoints>=0.2.2 in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.3) Requirement already satisfied: testpath in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.4.4) Requirement already satisfied: mistune<2,>=0.8.1 in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.8.4) Requirement already satisfied: nbclient<0.6.0,>=0.5.0 in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.5.1) Requirement already satisfied: jupyterlab-pygments in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.1.2) Requirement already satisfied: bleach in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (3.2.1) Requirement already satisfied: pandocfilters>=1.4.1 in c:\users\2104944461\anaconda3\lib\site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.4.3) Requirement already satisfied: async-generator in c:\users\2104944461\anaconda3\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.10) Requirement already satisfied: nest-asyncio in c:\users\2104944461\anaconda3\lib\site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (1.4.2) Requirement already satisfied: webencodings in c:\users\2104944461\anaconda3\lib\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (0.5.1) Requirement already satisfied: packaging in c:\users\2104944461\anaconda3\lib\site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (20.4) Requirement already satisfied: pyparsing>=2.0.2 in c:\users\2104944461\anaconda3\lib\site-packages (from packaging->bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets) (2.4.7)
PS: Percebi que usando sweetviz poderia automatizar o processo de EDA, poderia ter uma visualização mais completa olhando para todos os pontos que tive no começo, acredito que dessa forma, pouco tempo no processo de descobertas, com essa tecnica consigo entrar mais no detalhe e ter a percepção que o padrão das partidas variam de acordo com time e em relação a vida,dinheiro, tipo de arma, e classificação de ct ou t.
# por favor rode o sweetviz e veja o resultado da analise
try:
import sweetviz as sv
my_report = sv.analyze(base)
except:
print("Falha ao Instalar o Sweetviz")
Percebi que o grafico de barras apresenta uma distribuição em barras com os seguintes dados
| TOP | CATEGORIES |
|---|---|
| 042 | 09534% |
| 127 | 40022% |
| 217 | 21814% |
| 315 | 38613% |
| 412 | 01310% |
| 58 | 2987% |
try:
my_report.show_notebook()
except:
print("Falha ao Gerar Relatorio no Notebook")
Para prosseguir com a base preciso mapear e converter a coluna map para um tipo string para isso mapei os index usando groubpy e em seguida usei a funcção do apply para fazer as trocas.
base[['map','round_winner']].groupby(['map']).count().T
| map | de_cache | de_dust2 | de_inferno | de_mirage | de_nuke | de_overpass | de_train | de_vertigo |
|---|---|---|---|---|---|---|---|---|
| round_winner | 145 | 22144 | 23811 | 18576 | 19025 | 14081 | 13491 | 11137 |
maps = list(base[['map','round_winner']].groupby(['map']).count().T.to_dict().keys())
for dados in enumerate(maps):
print(dados)
(0, 'de_cache') (1, 'de_dust2') (2, 'de_inferno') (3, 'de_mirage') (4, 'de_nuke') (5, 'de_overpass') (6, 'de_train') (7, 'de_vertigo')
maps.index('de_vertigo')
7
base['map'] = base['map'].apply(lambda x:maps.index(x))
base['map']
0 1
1 1
2 1
3 1
4 1
..
122405 6
122406 6
122407 6
122408 6
122409 6
Name: map, Length: 122410, dtype: int64
base
| time_left | ct_score | t_score | map | ct_health | t_health | ct_money | t_money | ct_helmets | t_helmets | ct_defuse_kits | ct_players_alive | t_players_alive | ct_weapon_ak47 | t_weapon_ak47 | ct_weapon_aug | t_weapon_aug | ct_weapon_awp | t_weapon_awp | ct_weapon_bizon | t_weapon_bizon | ct_weapon_cz75auto | t_weapon_cz75auto | ct_weapon_elite | t_weapon_elite | ct_weapon_famas | t_weapon_famas | ct_weapon_g3sg1 | t_weapon_g3sg1 | ct_weapon_galilar | t_weapon_galilar | ct_weapon_glock | t_weapon_glock | ct_weapon_m249 | t_weapon_m249 | ct_weapon_m4a1s | t_weapon_m4a1s | ct_weapon_m4a4 | t_weapon_m4a4 | ct_weapon_mac10 | t_weapon_mac10 | ct_weapon_mag7 | t_weapon_mag7 | ct_weapon_mp5sd | t_weapon_mp5sd | ct_weapon_mp7 | t_weapon_mp7 | ct_weapon_mp9 | t_weapon_mp9 | ct_weapon_negev | t_weapon_negev | ct_weapon_nova | t_weapon_nova | ct_weapon_p90 | t_weapon_p90 | ct_weapon_r8revolver | t_weapon_r8revolver | ct_weapon_sawedoff | t_weapon_sawedoff | ct_weapon_scar20 | t_weapon_scar20 | ct_weapon_sg553 | t_weapon_sg553 | ct_weapon_ssg08 | t_weapon_ssg08 | ct_weapon_ump45 | t_weapon_ump45 | ct_weapon_xm1014 | t_weapon_xm1014 | ct_weapon_deagle | t_weapon_deagle | ct_weapon_fiveseven | t_weapon_fiveseven | ct_weapon_usps | t_weapon_usps | ct_weapon_p250 | t_weapon_p250 | ct_weapon_p2000 | t_weapon_p2000 | ct_weapon_tec9 | t_weapon_tec9 | ct_grenade_hegrenade | t_grenade_hegrenade | ct_grenade_flashbang | t_grenade_flashbang | ct_grenade_smokegrenade | t_grenade_smokegrenade | ct_grenade_incendiarygrenade | t_grenade_incendiarygrenade | ct_grenade_molotovgrenade | t_grenade_molotovgrenade | ct_grenade_decoygrenade | t_grenade_decoygrenade | round_winner | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 175.00 | 0 | 0 | 1 | 500 | 500 | 4000 | 4000 | 0 | 0 | 0 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| 1 | 156.03 | 0 | 0 | 1 | 500 | 500 | 600 | 650 | 0 | 0 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0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 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 122405 | 15.41 | 11 | 14 | 6 | 200 | 242 | 100 | 5950 | 2 | 4 | 1 | 2 | 4 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 2 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 |
| 122406 | 174.93 | 11 | 15 | 6 | 500 | 500 | 11500 | 23900 | 1 | 2 | 1 | 5 | 5 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |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| 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 0 | 0 | 0 | 0 | 0 | 0 | 2 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3 | 0 | 2 | 0 | 0 | 0 | 3 | 0 | 0 | 1 |
122410 rows × 94 columns
base['ct_score']
0 0
1 0
2 0
3 0
4 1
..
122405 11
122406 11
122407 11
122408 11
122409 11
Name: ct_score, Length: 122398, dtype: int64
def detect_outlier(data):
# find q1 and q3 values
q1, q3 = np.percentile(sorted(data), [25, 75])
# compute IRQ
iqr = q3 - q1
# find lower and upper bounds
lower_bound = q1 - (1.5 * iqr)
upper_bound = q3 + (1.5 * iqr)
outliers = [x for x in data if x <= lower_bound or x >= upper_bound]
return outliers
base.drop(detect_outlier(base['ct_score']),inplace=True)
base.describe().T
| count | mean | std | min | 25% | 50% | 75% | max | |
|---|---|---|---|---|---|---|---|---|
| time_left | 122398.0 | 97.885604 | 54.465466 | 0.01 | 54.92 | 94.91 | 166.91 | 175.0 |
| ct_score | 122398.0 | 6.709603 | 4.790456 | 0.00 | 3.00 | 6.00 | 10.00 | 32.0 |
| t_score | 122398.0 | 6.780952 | 4.823494 | 0.00 | 3.00 | 6.00 | 10.00 | 33.0 |
| map | 122398.0 | 3.520417 | 1.929022 | 0.00 | 2.00 | 3.00 | 5.00 | 7.0 |
| ct_health | 122398.0 | 412.111840 | 132.289775 | 0.00 | 350.00 | 500.00 | 500.00 | 500.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... |
| ct_grenade_molotovgrenade | 122398.0 | 0.048015 | 0.227680 | 0.00 | 0.00 | 0.00 | 0.00 | 3.0 |
| t_grenade_molotovgrenade | 122398.0 | 1.352016 | 1.663186 | 0.00 | 0.00 | 1.00 | 2.00 | 5.0 |
| ct_grenade_decoygrenade | 122398.0 | 0.027697 | 0.169539 | 0.00 | 0.00 | 0.00 | 0.00 | 3.0 |
| t_grenade_decoygrenade | 122398.0 | 0.025752 | 0.164170 | 0.00 | 0.00 | 0.00 | 0.00 | 2.0 |
| round_winner | 122398.0 | 0.509771 | 0.499907 | 0.00 | 0.00 | 1.00 | 1.00 | 1.0 |
94 rows × 8 columns
base.to_csv("treino_08_31_00_31-10-2021.csv",index=False)